using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Arrow : MonoBehaviour
{
    public GameObject detination;
    private void OnTriggerEnter(Collider other)
    {
        if(other.tag=="Enemy")
        {
            other.GetComponent<IEnemy>().GetHit(30);
            Destroy(gameObject);
        }
    }
    private void Update()
    {
        if(detination!=null)
        {
            transform.LookAt(detination.transform.position);
            transform.Translate(Vector3.forward * 2*0.01f );
        }
    }
    private void Awake()
    {
        Destroy(gameObject, 10);
    }
}
